
#ifndef _SKFAPI_H_
#define _SKFAPI_H_

#pragma pack(1)

#define SAR_OK							0x00000000	//≥…π¶
#define SAR_FAIL						0x0A000001	// ß∞‹
#define SAR_UNKNOWNERR					0x0A000002	//“Ï≥£¥ÌŒÛ
#define SAR_NOTSUPPORTYETERR			0x0A000003	//≤ª÷ß≥÷µƒ∑˛ŒÒ
#define SAR_FILEERR						0x0A000004	//Œƒº˛≤Ÿ◊˜¥ÌŒÛ
#define SAR_INVALIDHANDLEERR			0x0A000005	//Œﬁ–ßµƒæ‰±˙
#define SAR_INVALIDPARAMERR				0x0A000006	//Œﬁ–ßµƒ≤Œ ˝
#define SAR_READFILEERR					0x0A000007	//∂¡Œƒº˛¥ÌŒÛ
#define SAR_WRITEFILEERR				0x0A000008	//–¥Œƒº˛¥ÌŒÛ
#define SAR_NAMELENERR					0x0A000009	//√˚≥∆≥§∂»¥ÌŒÛ
#define SAR_KEYUSAGEERR					0x0A00000A	//√‹‘ø”√Õæ¥ÌŒÛ
#define SAR_MODULUSLENERR				0x0A00000B	//ƒ£µƒ≥§∂»¥ÌŒÛ
#define SAR_NOTINITIALIZEERR			0x0A00000C	//Œ¥≥ı ºªØ
#define SAR_OBJERR						0x0A00000D	//∂‘œÛ¥ÌŒÛ
#define SAR_MEMORYERR					0x0A00000E	//ƒ⁄¥Ê¥ÌŒÛ
#define SAR_TIMEOUTERR					0x0A00000F	//≥¨ ±
#define SAR_INDATALENERR				0x0A000010	// ‰»Î ˝æ›≥§∂»¥ÌŒÛ
#define SAR_INDATAERR					0x0A000011	// ‰»Î ˝æ›¥ÌŒÛ
#define SAR_GENRANDERR					0x0A000012	//…˙≥…ÀÊª˙ ˝¥ÌŒÛ
#define SAR_HASHOBJERR					0x0A000013	//HASH∂‘œÛ¥ÌŒÛ
#define SAR_HASHERR						0x0A000014	//HASH‘ÀÀ„¥ÌŒÛ
#define SAR_GENRSAKEYERR				0x0A000015	//≤˙…˙RSA√‹‘ø¥ÌŒÛ
#define SAR_RSAMODULUSLENERR			0x0A000016	//RSA√‹‘øƒ£≥§¥ÌŒÛ
#define SAR_CSPIMPRTPUBKEYERR			0x0A000017	//CSP∑˛ŒÒµº»Îπ´‘ø¥ÌŒÛ
#define SAR_RSAENCERR					0x0A000018	//RSAº”√‹¥ÌŒÛ
#define SAR_RSADECERR					0x0A000019	//RSAΩ‚√‹¥ÌŒÛ
#define SAR_HASHNOTEQUALERR				0x0A00001A	//HASH÷µ≤ªœ‡µ»
#define SAR_KEYNOTFOUNTERR				0x0A00001B	//Œ¥∑¢œ÷√‹‘ø
#define SAR_CERTNOTFOUNTERR				0x0A00001C	//Œ¥∑¢œ÷÷§ È
#define SAR_NOTEXPORTERR				0x0A00001D	//∂‘œÛŒ¥µº≥ˆ
#define SAR_DECRYPTPADERR				0x0A00001E	//Ω‚√‹ ±◊ˆ≤π∂°¥ÌŒÛ
#define SAR_MACLENERR					0x0A00001F	//MAC≥§∂»¥ÌŒÛ
#define SAR_BUFFER_TOO_SMALL			0x0A000020	//ª∫≥Â«¯≤ª◊„
#define SAR_KEYINFOTYPEERR				0x0A000021	//√‹‘ø¿‡–Õ¥ÌŒÛ
#define SAR_NOT_EVENTERR				0x0A000022	//Œﬁ ¬º˛¥ÌŒÛ
#define SAR_DEVICE_REMOVED				0x0A000023	//…Ë±∏“—“∆≥˝
#define SAR_PIN_INCORRECT				0x0A000024	//PIN¥ÌŒÛ
#define SAR_PIN_LOCKED					0x0A000025	//PINÀ¯À¿
#define SAR_PIN_INVALID					0x0A000026	//PINŒﬁ–ß
#define SAR_PIN_LEN_RANGE				0x0A000027	//PIN≥§∂»¥ÌŒÛ
#define SAR_USER_ALREADY_LOGGED_IN		0x0A000028	//”√ªß“—æ≠µ«¬º
#define SAR_USER_PIN_NOT_INITIALIZED	0x0A000029	//√ª”–≥ı ºªØ”√ªßø⁄¡Ó
#define SAR_USER_TYPE_INVALID			0x0A00002A	//PIN¿‡–Õ¥ÌŒÛ
#define SAR_APPLICATION_NAME_INVALID	0x0A00002B	//”¶”√√˚≥∆Œﬁ–ß
#define SAR_APPLICATION_EXISTS			0x0A00002C	//”¶”√“—æ≠¥Ê‘⁄
#define SAR_USER_NOT_LOGGED_IN			0x0A00002D	//”√ªß√ª”–µ«¬º
#define SAR_APPLICATION_NOT_EXISTS		0x0A00002E	//”¶”√≤ª¥Ê‘⁄
#define SAR_FILE_ALREADY_EXIST			0x0A00002F	//Œƒº˛“—æ≠¥Ê‘⁄
#define SAR_NO_ROOM						0x0A000030	//¥Ê¥¢ø’º‰≤ª◊„
#define SAR_FILE_NOT_EXIST				0x0A000031	//Œƒº˛≤ª¥Ê‘⁄
#define SAR_REACH_MAX_CONTAINER_COUNT	0x0A000032	//“—¥ÔµΩ◊Ó¥Ûø…π‹¿Ì»›∆˜ ˝

#define SAR_SECURITY_INVALID			0x0B000033	//∞≤»´◊¥Ã¨≤ª¬˙◊„
#define SAR_OFFSET_VOER_FILE			0x0B000034	//÷∏’Î“∆µΩ≥¨π˝Œƒº˛≥§∂»
#define SAR_CONTAINER_NOT_FOUND			0x0B000035	//»›∆˜≤ª¥Ê‘⁄
#define SAR_CONTAINER_EXIST				0x0B000036	//»›∆˜“—¥Ê‘⁄
#define SAR_AUTH_LOCKED					0x0B000037	//…Ë±∏»œ÷§À¯∂®
#define SAR_ECCENCERR					0x0B000038	//ECCº”√‹¥ÌŒÛ


#ifdef _MSC_VER

#define DEVAPI  __stdcall

#else

#define DEVAPI

#endif


#ifdef __cplusplus
extern "C" {
#endif

	typedef signed char         INT8;
	typedef signed short        INT16;
	typedef signed int          INT32;
	typedef unsigned char       UINT8;
	typedef unsigned short      UINT16;
	typedef unsigned int	    UINT32;

	typedef UINT8				BYTE;
	typedef char				CHAR;
	typedef INT16				SHORT;
	typedef UINT16				USHORT;
	typedef long				LONG;
	typedef unsigned long		ULONG;
	typedef UINT32				UINT;
	typedef UINT16				WORD;
	typedef unsigned long		DWORD;
	typedef UINT32				FLAGS;
	typedef CHAR *				LPSTR;
	typedef void *				HANDLE;
	typedef int					BOOL;

	typedef HANDLE				DEVHANDLE;
	typedef HANDLE				HAPPLICATION;
	typedef HANDLE				HCONTAINER;


#define MAX_IV_LEN						32	//≥ı ºªØœÚ¡øµƒ◊Ó¥Û≥§∂»
#define	MAX_FILE_NAME_LEN				32	//Œƒº˛√˚◊Ó¥Û≥§∂»
#define MAX_CONTAINER_NAME_LEN			128	//»›∆˜√˚◊Ó¥Û≥§∂»
#define MIN_PIN_LEN						6	//◊Ó–°µƒPIN≥§∂»

#define MAX_RSA_MODULUS_LEN				256	//RSAÀ„∑®ƒ£ ˝µƒ◊Ó¥Û≥§∂»
#define MAX_RSA_EXPONENT_LEN			4	//RSAÀ„∑®÷∏ ˝µƒ◊Ó¥Û≥§∂»

#define ECC_MAX_XCOORDINATE_BITS_LEN	512	//ECCÀ„∑®X◊¯±Íµƒ◊Ó¥Û≥§∂»
#define ECC_MAX_YCOORDINATE_BITS_LEN	512	//ECCÀ„∑®Y◊¯±Íµƒ◊Ó¥Û≥§∂»
#define ECC_MAX_MODULUS_BITS_LEN		512	//ECCÀ„∑®ƒ£ ˝µƒ◊Ó¥Û≥§∂»


#define SGD_SM1_ECB				0x00000101	//SM1À„∑®ECBº”√‹ƒ£ Ω
#define SGD_SM1_CBC				0x00000102	//SM1À„∑®CBCº”√‹ƒ£ Ω
#define SGD_SM1_CFB				0x00000104	//SM1À„∑®CFBº”√‹ƒ£ Ω
#define SGD_SM1_OFB				0x00000108	//SM1À„∑®OFBº”√‹ƒ£ Ω
#define SGD_SM1_MAC				0x00000110	//SM1À„∑®MAC‘ÀÀ„
#define SGD_SSF33_ECB			0x00000201	//SSF33À„∑®ECBº”√‹ƒ£ Ω
#define SGD_SSF33_CBC			0x00000202	//SSF33À„∑®CBCº”√‹ƒ£ Ω
#define SGD_SSF33_CFB			0x00000204	//SSF33À„∑®CFBº”√‹ƒ£ Ω
#define SGD_SSF33_OFB			0x00000208	//SSF33À„∑®OFBº”√‹ƒ£ Ω
#define SGD_SSF33_MAC			0x00000210	//SSF33À„∑®MAC‘ÀÀ„
#define SGD_SM4_ECB				0x00000401	//SMS4À„∑®ECBº”√‹ƒ£ Ω
#define SGD_SM4_CBC				0x00000402	//SMS4À„∑®CBCº”√‹ƒ£ Ω
#define SGD_SM4_CFB				0x00000404	//SMS4À„∑®CFBº”√‹ƒ£ Ω
#define SGD_SM4_OFB				0x00000408	//SMS4À„∑®OFBº”√‹ƒ£ Ω
#define SGD_SM4_MAC				0x00000410	//SMS4À„∑®MAC‘ÀÀ„

//∑«∂‘≥∆√‹¬ÎÀ„∑®±Í ∂
#define SGD_RSA					0x00010000	//RSAÀ„∑®
#define SGD_SM2_1				0x00020100	//Õ÷‘≤«˙œﬂ«©√˚À„∑®
#define SGD_SM2_2				0x00020200	//Õ÷‘≤«˙œﬂ√‹‘øΩªªª–≠“È
#define SGD_SM2_3				0x00020400	//Õ÷‘≤«˙œﬂº”√‹À„∑®

//√‹¬Î‘”¥’À„∑®±Í ∂
#define SGD_SM3					0x00000001	//SM3‘”¥’À„∑®
#define SGD_SHA1				0x00000002	//SHA1‘”¥’À„∑®
#define SGD_SHA256				0x00000004	//SHA256‘”¥’À„∑®

//…Ë±∏◊¥Ã¨
#define	DEV_ABSENT_STATE		0x00000000	//…Ë±∏≤ª¥Ê‘⁄
#define	DEV_PRESENT_STATE		0x00000001	//…Ë±∏¥Ê‘⁄
#define DEV_UNKNOW_STATE        0x00000002   //…Ë±∏◊¥Ã¨Œ¥÷™

//…Ë±∏»®œﬁ
#define SECURE_NEVER_ACCOUNT	0x00000000	//≤ª‘ –Ì
#define SECURE_ADM_ACCOUNT		0x00000001	//π‹¿Ì‘±»®œﬁ
#define SECURE_USER_ACCOUNT		0x00000010	//”√ªß»®œﬁ
#define SECURE_EVERYONE_ACCOUNT	0x000000FF	//»Œ∫Œ»À


//PIN¬Î¿‡–Õ
#define	ADMIN_TYPE				0x00000000	// π‹¿Ì‘±PIN
#define USER_TYPE				0x00000001	// ”√ªßPIN

typedef struct Struct_Version{
	BYTE	major;	//÷˜∞Ê±æ∫≈
	BYTE	minor;	//¥Œ∞Ê±æ∫≈
} VERSION;


typedef struct Struct_DEVINFO{
	VERSION		Version;
	CHAR		Manufacturer[64];
	CHAR		Issuer[64];
	CHAR		Label[32];
	CHAR		SerialNumber[32];
	VERSION		HWVersion;
	VERSION		FirmwareVersion;
	ULONG		AlgSymCap;
	ULONG		AlgAsymCap;
	ULONG		AlgHashCap;
	ULONG		DevAuthAlgId;
	ULONG		TotalSpace;
	ULONG		FreeSpace;
	ULONG		MaxECCBufferSize;
	ULONG		MaxBufferSize;
	BYTE  		Reserved[64];
}DEVINFO,*PDEVINFO;


//RSAπ´‘øΩªªª ˝æ›øÈ
typedef struct Struct_RSAPUBLICKEYBLOB{
	ULONG	AlgID;									//À„∑®±Í ∂∫≈
	ULONG	BitLen;									//ƒ£ ˝µƒ µº Œª≥§∂»£¨±ÿ–Î «8µƒ±∂ ˝
	BYTE	Modulus[MAX_RSA_MODULUS_LEN];			//ƒ£ ˝n=p*q£¨ µº ≥§∂»Œ™BitLen/8◊÷Ω⁄
	BYTE	PublicExponent[MAX_RSA_EXPONENT_LEN];	//π´ø™√‹‘øe£¨ “ª∞„Œ™00010001
} RSAPUBLICKEYBLOB, *PRSAPUBLICKEYBLOB;


//RSAÀΩ‘øΩªªª ˝æ›øÈ
typedef struct Struct_RSAPRIVATEKEYBLOB{
	ULONG	AlgID;									//À„∑®±Í ∂∫≈
	ULONG	BitLen;									//ƒ£ ˝µƒ µº Œª≥§∂»£¨±ÿ–Î «8µƒ±∂ ˝
	BYTE	Modulus[MAX_RSA_MODULUS_LEN];			//ƒ£ ˝n=p*q£¨ µº ≥§∂»Œ™BitLen/8◊÷Ω⁄
	BYTE	PublicExponent[MAX_RSA_EXPONENT_LEN];	//π´ø™√‹‘øe£¨ “ª∞„Œ™00010001
	BYTE	PrivateExponent[MAX_RSA_MODULUS_LEN];	//ÀΩ”–√‹‘ød£¨ µº ≥§∂»Œ™BitLen/8◊÷Ω⁄
	BYTE	Prime1[MAX_RSA_MODULUS_LEN/2];			//Àÿ ˝p£¨ µº ≥§∂»Œ™BitLen/16◊÷Ω⁄
	BYTE	Prime2[MAX_RSA_MODULUS_LEN/2];			//Àÿ ˝q£¨ µº ≥§∂»Œ™BitLen/16◊÷Ω⁄
	BYTE	Prime1Exponent[MAX_RSA_MODULUS_LEN/2];	//d mod (p-1)µƒ÷µ,  µº ≥§∂»Œ™BitLen/16◊÷Ω⁄
	BYTE	Prime2Exponent[MAX_RSA_MODULUS_LEN/2];	//d mod (q-1)µƒ÷µ£¨ µº ≥§∂»Œ™BitLen/16◊÷Ω⁄
	BYTE	Coefficient[MAX_RSA_MODULUS_LEN/2];		//qƒ£pµƒ≥À∑®ƒÊ‘™£¨ µº ≥§∂»Œ™BitLen/16◊÷Ω⁄
} RSAPRIVATEKEYBLOB, *PRSAPRIVATEKEYBLOB;

//ECCπ´‘øΩªªª ˝æ›øÈ
typedef struct Struct_ECCPUBLICKEYBLOB{
	ULONG	BitLen;
	BYTE	XCoordinate[ECC_MAX_XCOORDINATE_BITS_LEN/8];
	BYTE	YCoordinate[ECC_MAX_YCOORDINATE_BITS_LEN/8];
}ECCPUBLICKEYBLOB, *PECCPUBLICKEYBLOB;


//ECCÀΩ‘øΩªªª ˝æ›øÈ
typedef struct Struct_ECCPRIVATEKEYBLOB{
	ULONG	BitLen;
	BYTE	PrivateKey[ECC_MAX_MODULUS_BITS_LEN/8];
}ECCPRIVATEKEYBLOB, *PECCPRIVATEKEYBLOB;



// ECC√‹Œƒ ˝æ›Ω·ππ
typedef struct Struct_ECCCIPHERBLOB{
	BYTE	XCoordinate[ECC_MAX_XCOORDINATE_BITS_LEN/8]; 
	BYTE	YCoordinate[ECC_MAX_XCOORDINATE_BITS_LEN/8]; 
	BYTE	HASH[32];
	ULONG	CipherLen;
	BYTE	Cipher[1];
} ECCCIPHERBLOB, *PECCCIPHERBLOB;


// ECC«©√˚ ˝æ›Ω·ππ
typedef struct Struct_ECCSIGNATUREBLOB{
	BYTE	r[ECC_MAX_XCOORDINATE_BITS_LEN/8];
	BYTE	s[ECC_MAX_YCOORDINATE_BITS_LEN/8];
} ECCSIGNATUREBLOB, *PECCSIGNATUREBLOB;

//ECCº”√‹√‹‘ø∂‘±£ª§Ω·ππ
typedef struct SKF_ENVELOPEDKEYBLOB{
	ULONG Version;                  // µ±«∞∞Ê±æŒ™ 1
	ULONG ulSymmAlgID;              // πÊ∑∂÷–µƒÀ„∑®±Í ∂£¨œﬁ∂®ECBƒ£ Ω
	ULONG ulBits;					// º”√‹√‹‘ø∂‘µƒ√‹‘øŒª≥§∂»
	BYTE cbEncryptedPriKey[64];     // º”√‹±£ª§µƒº”√‹ÀΩ‘ø
	ECCPUBLICKEYBLOB PubKey;        // º”√‹π´‘ø
	ECCCIPHERBLOB ECCCipherBlob;    // SM2 π´‘øº”√‹µƒ√‹‘øº”√‹√‹‘ø
}ENVELOPEDKEYBLOB, *PENVELOPEDKEYBLOB;

////////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////////
typedef struct Struct_BLOCKCIPHERPARAM{
	BYTE	IV[MAX_IV_LEN];			//≥ı ºœÚ¡ø£¨MAX_IV_LENŒ™≥ı ºœÚ¡øµƒ◊Ó¥Û≥§∂»
	ULONG	IVLen;					//≥ı ºœÚ¡ø µº ≥§∂»£¨∞¥◊÷Ω⁄º∆À„
	ULONG	PaddingType;			//ÃÓ≥‰∑Ω Ω£¨0±Ì æ≤ªÃÓ≥‰£¨1±Ì æ∞¥’’PKCS#5∑Ω ΩΩ¯––ÃÓ≥‰
	ULONG	FeedBitLen;				//∑¥¿°÷µµƒŒª≥§∂»£¨∞¥◊÷Ω⁄º∆À„£¨÷ª’Î∂‘OFB°¢CFBƒ£ Ω
} BLOCKCIPHERPARAM, *PBLOCKCIPHERPARAM;

// Œƒº˛ Ù–‘
typedef struct Struct_FILEATTRIBUTE{
	CHAR	FileName[32];
	ULONG	FileSize;
	ULONG	ReadRights;
	ULONG	WriteRights; 
}FILEATTRIBUTE, *PFILEATTRIBUTE;

#pragma pack()
/************************************************************************/
/*	1. …Ë±∏π‹¿Ì	œµ¡–∫Ø ˝														*/
/*	SKF_WaitForDevEvent													*/
/*	SKF_CancelWaitForDevEvent											*/
/*	SKF_EnumDev															*/
/*	SKF_ConnectDev														*/
/*	SKF_DisconnectDev													*/
/*	SKF_GetDevState														*/
/*	SKF_SetLable														*/
/*	SKF_GetDevInfo														*/
/*	SKF_LockDev															*/
/*	SKF_UnlockDev														*/
/*	SKF_Transmit														*/
/************************************************************************/

/*
*	µ»¥˝…Ë±∏µƒ≤Â∞Œ ¬º˛
*	szDevName		[OUT]∑µªÿ∑¢…˙ ¬º˛µƒ…Ë±∏√˚≥∆
*	pulDevNameLen	[IN,OUT] ‰»Î/ ‰≥ˆ≤Œ ˝£¨µ± ‰»Î ±±Ì æª∫≥Â«¯≥§∂»£¨ ‰≥ˆ ±±Ì æ…Ë±∏√˚≥∆µƒ”––ß≥§∂»,≥§∂»∞¸∫¨◊÷∑˚¥ÆΩ· ¯∑˚
*	pulEvent		[OUT] ¬º˛¿‡–Õ°£1±Ì æ≤Â»Î£¨2±Ì æ∞Œ≥ˆ
*	±∏◊¢: ∏√∫Ø ˝ «◊Ë»˚µ˜”√µƒ
*/
ULONG DEVAPI SKF_WaitForDevEvent(LPSTR szDevName,ULONG *pulDevNameLen, ULONG *pulEvent);
ULONG DEVAPI SKF_CancelWaitForDevEvent();

/*
*	ªÒµ√µ±«∞œµÕ≥÷–µƒ…Ë±∏¡–±Ì
*	bPresent		[IN]Œ™TRUE±Ì æ»°µ±«∞…Ë±∏◊¥Ã¨Œ™¥Ê‘⁄µƒ…Ë±∏¡–±Ì°£Œ™FALSE±Ì æ»°µ±«∞«˝∂Ø÷ß≥÷µƒ…Ë±∏¡–±Ì
*	szNameList		[OUT]…Ë±∏√˚≥∆¡–±Ì°£»Áπ˚∏√≤Œ ˝Œ™NULL£¨Ω´”…pulSize∑µªÿÀ˘–Ë“™µƒƒ⁄¥Êø’º‰¥Û–°°£√ø∏ˆ…Ë±∏µƒ√˚≥∆“‘µ•∏ˆ'\0'Ω· ¯£¨“‘À´'\0'±Ì æ¡–±ÌµƒΩ· ¯
*	pulSize			[IN,OUT] ‰»Î≤Œ ˝£¨ ‰»Î…Ë±∏√˚≥∆¡–±Ìµƒª∫≥Â«¯≥§∂»£¨ ‰≥ˆ≤Œ ˝£¨∑µªÿszNameListÀ˘–Ë“™µƒø’º‰¥Û–°
*/
ULONG DEVAPI SKF_EnumDev(BOOL bPresent, LPSTR szNameList, ULONG *pulSize);
/*
*	Õ®π˝…Ë±∏√˚≥∆¡¨Ω”…Ë±∏£¨∑µªÿ…Ë±∏µƒæ‰±˙
*	szName		[IN]…Ë±∏√˚≥∆
*	phDev		[OUT]∑µªÿ…Ë±∏≤Ÿ◊˜æ‰±˙
*/
ULONG DEVAPI SKF_ConnectDev (LPSTR szName, DEVHANDLE *phDev);
/*
*	∂œø™“ª∏ˆ“—æ≠¡¨Ω”µƒ…Ë±∏£¨≤¢ Õ∑≈æ‰±˙°£
*	hDev		[IN]¡¨Ω”…Ë±∏ ±∑µªÿµƒ…Ë±∏æ‰±˙
*/
ULONG DEVAPI SKF_DisConnectDev (DEVHANDLE hDev);
/*
*	ªÒ»°…Ë±∏ «∑Ò¥Ê‘⁄µƒ◊¥Ã¨
*	szDevName	[IN]¡¨Ω”√˚≥∆
*	pulDevState	[OUT]∑µªÿ…Ë±∏◊¥Ã¨
*/
ULONG DEVAPI SKF_GetDevState(LPSTR szDevName, ULONG *pulDevState);
/*
*	…Ë÷√…Ë±∏±Í«©
*	hDev		[IN]¡¨Ω”…Ë±∏ ±∑µªÿµƒ…Ë±∏æ‰±˙
*	szLabel		[OUT]…Ë±∏±Í«©◊÷∑˚¥Æ°£∏√◊÷∑˚¥Æ”¶–°”⁄32◊÷Ω⁄
*/
ULONG DEVAPI SKF_SetLabel(DEVHANDLE hDev, LPSTR szLabel);
/*
*	ªÒ»°…Ë±∏µƒ“ª–©Ãÿ’˜–≈œ¢£¨∞¸¿®…Ë±∏±Í«©°¢≥ß…Ã–≈œ¢°¢÷ß≥÷µƒÀ„∑®µ»
*	hDev		[IN]¡¨Ω”…Ë±∏ ±∑µªÿµƒ…Ë±∏æ‰±˙
*	pDevInfo	[OUT]∑µªÿ…Ë±∏–≈œ¢
*/
ULONG DEVAPI SKF_GetDevInfo (DEVHANDLE hDev, DEVINFO *pDevInfo);
/*
*	ªÒµ√…Ë±∏µƒ∂¿’º π”√»®
*	hDev		[IN]¡¨Ω”…Ë±∏ ±∑µªÿµƒ…Ë±∏æ‰±˙
*	ulTimeOut	[IN]≥¨ ± ±º‰£¨µ•ŒªŒ™∫¡√Î°£»Áπ˚Œ™0xFFFFFFFF±Ì æŒﬁœﬁµ»¥˝
*/	
ULONG DEVAPI SKF_LockDev (DEVHANDLE hDev, ULONG ulTimeOut);
/*
*	 Õ∑≈∂‘…Ë±∏µƒ∂¿’º π”√»®
*	hDev		[IN]¡¨Ω”…Ë±∏ ±∑µªÿµƒ…Ë±∏æ‰±˙
*/
ULONG DEVAPI SKF_UnlockDev (DEVHANDLE hDev);

/*
*	Ω´√¸¡Ó÷±Ω”∑¢ÀÕ∏¯…Ë±∏£¨≤¢∑µªÿΩ·π˚
*	hDev			[IN]…Ë±∏æ‰±˙
*	pbCommand		[IN]…Ë±∏√¸¡Ó
*	ulCommandLen	[IN]√¸¡Ó≥§∂»
*	pbData			[OUT]∑µªÿΩ·π˚ ˝æ›
*	pulDataLen		[IN,OUT] ‰»Îª∫≥Â«¯≥§∂»£¨ ‰≥ˆ∑µªÿ ˝æ›≥§∂»
*/
ULONG DEVAPI SKF_Transmit(DEVHANDLE hDev, BYTE* pbCommand, ULONG ulCommandLen, BYTE* pbData, ULONG* pulDataLen);


/************************************************************************/
/*  2. ∑√Œ øÿ÷∆	œµ¡–∫Ø ˝                                           */
/*	SKF_ChangeDevAuthKey												*/
/*	SKF_DevAuth															*/
/*	SKF_ChangePIN														*/
/*	SKF_GetPINInfo														*/
/*	SKF_VerifyPIN														*/
/*	SKF_UnblockPIN														*/
/*	SKF_ClearSecureState												*/
/************************************************************************/

/*
*	∏¸∏ƒ…Ë±∏»œ÷§√‹‘ø
*	hDev		[IN]¡¨Ω” ±∑µªÿµƒ…Ë±∏æ‰±˙
*	pbKeyValue	[IN]√‹‘ø÷µ
*	ulKeyLen	[IN]√‹‘ø≥§∂»
*/
ULONG DEVAPI SKF_ChangeDevAuthKey (DEVHANDLE hDev, BYTE *pbKeyValue, ULONG ulKeyLen);

/*
*	…Ë±∏»œ÷§ «…Ë±∏∂‘”¶”√≥Ã–Úµƒ»œ÷§
*	hDev			[IN]¡¨Ω” ±∑µªÿµƒ…Ë±∏æ‰±˙
*	pbAuthData		[IN]»œ÷§ ˝æ›
*	ulLen			[IN]»œ÷§ ˝æ›µƒ≥§∂»
*/
ULONG DEVAPI SKF_DevAuth (DEVHANDLE hDev, BYTE *pbAuthData,ULONG ulLen);
/*
*	–ﬁ∏ƒPIN£¨ø…“‘–ﬁ∏ƒAdmin∫ÕUserµƒPIN£¨»Áπ˚‘≠PIN¥ÌŒÛ£¨∑µªÿ £”‡÷ÿ ‘¥Œ ˝£¨µ± £”‡¥Œ ˝Œ™0 ±£¨±Ì æPIN“—æ≠±ªÀ¯À¿
*	hApplication	[IN]”¶”√æ‰±˙
*	ulPINType		[IN]PIN¿‡–Õ£¨ø…“‘Œ™ADMIN_TYPE=0£¨ªÚUSER_TYPE=1
*	szOldPIN		[IN]‘≠PIN÷µ
*	szNewPIN		[IN]–¬PIN÷µ
*	pulRetryCount	[OUT]≥ˆ¥Ì∫Û÷ÿ ‘¥Œ ˝
*/
ULONG DEVAPI SKF_ChangePIN (HAPPLICATION hApplication, ULONG ulPINType, LPSTR szOldPin, LPSTR szNewPin, ULONG *pulRetryCount);

/*
*	ªÒ»°PIN¬Î–≈œ¢£¨∞¸¿®◊Ó¥Û÷ÿ ‘¥Œ ˝°¢µ±«∞ £”‡÷ÿ ‘¥Œ ˝£¨“‘º∞µ±«∞PIN¬Î «∑ÒŒ™≥ˆ≥ßƒ¨»œPIN¬Î
*	hApplication		[IN]”¶”√æ‰±˙
*	ulPINType			[IN]PIN¿‡–Õ
*	pulMaxRetryCount	[OUT]◊Ó¥Û÷ÿ ‘¥Œ ˝
*	pulRemainRetryCount	[OUT]µ±«∞ £”‡÷ÿ ‘¥Œ ˝£¨µ±Œ™0 ±±Ì æ“—À¯À¿
*	pbDefaultPin		[OUT] «∑ÒŒ™≥ˆ≥ßƒ¨»œPIN¬Î
*/
ULONG DEVAPI SKF_GetPINInfo(HAPPLICATION hApplication, ULONG  ulPINType, ULONG *pulMaxRetryCount, ULONG *pulRemainRetryCount, BOOL *pbDefaultPin);

/*
*	–£—ÈPIN¬Î°£–£—È≥…π¶∫Û£¨ª·ªÒµ√œ‡”¶µƒ»®œﬁ£¨»Áπ˚PIN¬Î¥ÌŒÛ£¨ª·∑µªÿPIN¬Îµƒ÷ÿ ‘¥Œ ˝£¨µ±÷ÿ ‘¥Œ ˝Œ™0 ±±Ì æPIN¬Î“—æ≠À¯À¿
*	hApplication	[IN]”¶”√æ‰±˙
*	ulPINType		[IN]PIN¿‡–Õ£¨ø…“‘Œ™ADMIN_TYPE=0£¨ªÚUSER_TYPE=1
*	szPIN			[IN]PIN÷µ
*	pulRetryCount	[OUT]≥ˆ¥Ì∫Û∑µªÿµƒ÷ÿ ‘¥Œ ˝
*/
ULONG DEVAPI SKF_VerifyPIN (HAPPLICATION hApplication, ULONG  ulPINType, LPSTR szPIN, ULONG *pulRetryCount);
/*
*	µ±”√ªßµƒPIN¬ÎÀ¯À¿∫Û£¨Õ®π˝µ˜”√∏√∫Ø ˝¿¥Ω‚À¯”√ªßPIN¬Î°£
*	Ω‚À¯∫Û£¨”√ªßPIN¬Î±ª…Ë÷√≥…–¬÷µ£¨”√ªßPIN¬Îµƒ÷ÿ ‘¥Œ ˝“≤ª÷∏¥µΩ‘≠÷µ°£
*	hApplication	[IN]”¶”√æ‰±˙
*	szAdminPIN		[IN]π‹¿Ì‘±PIN¬Î
*	szNewUserPIN	[IN]–¬µƒ”√ªßPIN¬Î
*	pulRetryCount	[OUT]π‹¿Ì‘±PIN¬Î¥ÌŒÛ ±£¨∑µªÿ £”‡÷ÿ ‘¥Œ ˝
*/
ULONG DEVAPI SKF_UnblockPIN (HAPPLICATION hApplication, LPSTR szAdminPIN, LPSTR szNewUserPIN,  ULONG *pulRetryCount);

/*
*	µ±”√ªßµƒPIN¬ÎÀ¯À¿∫Û£¨Õ®π˝µ˜”√∏√∫Ø ˝¿¥Ω‚À¯”√ªßPIN¬Î°£
*	Ω‚À¯∫Û£¨”√ªßPIN¬Î±ª…Ë÷√≥…–¬÷µ£¨”√ªßPIN¬Îµƒ÷ÿ ‘¥Œ ˝“≤ª÷∏¥µΩ‘≠÷µ°£
*	hApplication	[IN]”¶”√æ‰±˙
*	pbCipherPIN		[IN]π‹¿Ì‘±PIN◊ˆsha1£¨»°16Œª◊ˆŒ™KEY£¨”√KEYº”√‹–¬µƒ”√ªßPINµ√µΩ√‹Œƒ£¨”√ÀÊª˙ ˝∂‘KEY◊ˆMAC£¨º”µΩ√‹Œƒµƒ∫Û√Ê
*	pulRetryCount	[OUT]π‹¿Ì‘±PIN¬Î¥ÌŒÛ ±£¨∑µªÿ £”‡÷ÿ ‘¥Œ ˝
*/
ULONG DEVAPI SKF_RemoteUnblockPIN (HAPPLICATION hApplication, BYTE *pbCipherPIN, ULONG ulCipherPINLen,  ULONG *pulRetryCount);

/*
*	«Â≥˝”¶”√µ±«∞µƒ∞≤»´◊¥Ã¨
*	hApplication	[IN]”¶”√æ‰±˙
*/
ULONG DEVAPI SKF_ClearSecureState (HAPPLICATION hApplication);

/************************************************************************/
/*  3. ”¶”√π‹¿Ìœµ¡–∫Ø ˝                                           */
/*	SKF_CreateApplication												*/
/*	SKF_EnumApplication													*/
/*	SKF_DeleteApplication												*/
/*	SKF_OpenApplication													*/
/*	SKF_CloseApplication												*/
/************************************************************************/

/*
*	¥¥Ω®“ª∏ˆ”¶”√
*	hDev					[IN]¡¨Ω”…Ë±∏ ±∑µªÿµƒ…Ë±∏æ‰±˙
*	szAppName				[IN]”¶”√√˚≥∆
*	szAdminPIN				[IN]π‹¿Ì‘±PIN
*	dwAdminPinRetryCount	[IN]π‹¿Ì‘±PIN◊Ó¥Û÷ÿ ‘¥Œ ˝
*	szUserPIN				[IN]”√ªßPIN
*	dwAdminPinRetryCount	[IN]”√ªßPIN◊Ó¥Û÷ÿ ‘¥Œ ˝
*	dwCreateFileRights		[IN]‘⁄∏√”¶”√œ¬¥¥Ω®Œƒº˛∫Õ»›∆˜µƒ»®œﬁ
*	phApplication			[OUT]”¶”√µƒæ‰±˙
*/
ULONG DEVAPI SKF_CreateApplication(DEVHANDLE hDev, LPSTR szAppName, LPSTR szAdminPin, DWORD dwAdminPinRetryCount,LPSTR szUserPin, DWORD dwUserPinRetryCount,DWORD dwCreateFileRights, HAPPLICATION *phApplication);

/*
*	√∂æŸ…Ë±∏÷–À˘¥Ê‘⁄µƒÀ˘”–”¶”√
*	hDev			[IN]¡¨Ω”…Ë±∏ ±∑µªÿµƒ…Ë±∏æ‰±˙
*	szAppName		[OUT]∑µªÿ”¶”√√˚≥∆¡–±Ì, »Áπ˚∏√≤Œ ˝Œ™ø’£¨Ω´”…pulSize∑µªÿÀ˘–Ë“™µƒƒ⁄¥Êø’º‰¥Û–°°£
*						 √ø∏ˆ”¶”√µƒ√˚≥∆“‘µ•∏ˆ'\0'Ω· ¯£¨“‘À´'\0'±Ì æ¡–±ÌµƒΩ· ¯°£
*	pulSize			[IN,OUT] ‰»Î≤Œ ˝£¨ ‰»Î”¶”√√˚≥∆µƒª∫≥Â«¯≥§∂»£¨ ‰≥ˆ≤Œ ˝£¨∑µªÿszAppNameÀ˘’º”√µƒµƒø’º‰¥Û–°
*/
ULONG DEVAPI SKF_EnumApplication(DEVHANDLE hDev, LPSTR szAppName,ULONG *pulSize);
/*
*	…æ≥˝÷∏∂®µƒ”¶”√
*	hDev			[IN]¡¨Ω”…Ë±∏ ±∑µªÿµƒ…Ë±∏æ‰±˙
*	szAppName		[IN]”¶”√√˚≥∆
*/
ULONG DEVAPI SKF_DeleteApplication(DEVHANDLE hDev, LPSTR szAppName);
/*
*	¥Úø™÷∏∂®µƒ”¶”√
*	hDev			[IN]¡¨Ω”…Ë±∏ ±∑µªÿµƒ…Ë±∏æ‰±˙
*	szAppName		[IN]”¶”√√˚≥∆
*	phApplication	[OUT]”¶”√µƒæ‰±˙
*/
ULONG DEVAPI SKF_OpenApplication(DEVHANDLE hDev, LPSTR szAppName, HAPPLICATION *phApplication);
/*
*	πÿ±’”¶”√≤¢ Õ∑≈”¶”√æ‰±˙
*	hApplication	[IN]”¶”√µƒæ‰±˙
*/
ULONG DEVAPI SKF_CloseApplication(HAPPLICATION hApplication);

/************************************************************************/
/*  4. Œƒº˛π‹¿Ì				                                            */
/*	SKF_CreateFile														*/
/*	SKF_DeleteFile														*/
/*	SKF_EnumFiles														*/
/*	SKF_GetFileInfo														*/
/*	SKF_ReadFile														*/
/*	SKF_WriteFile														*/
/************************************************************************/

/*
*	¥¥Ω®“ª∏ˆŒƒº˛°£¥¥Ω®Œƒº˛ ±“™÷∏∂®Œƒº˛µƒ√˚≥∆£¨¥Û–°£¨“‘º∞Œƒº˛µƒ∂¡–¥»®œﬁ
*	hApplication		[IN]”¶”√æ‰±˙
*	szFileName			[IN]Œƒº˛√˚≥∆£¨≥§∂»≤ªµ√¥Û”⁄32∏ˆ◊÷Ω⁄
*	ulFileSize			[IN]Œƒº˛¥Û–°
*	ulReadRights		[IN]Œƒº˛∂¡»®œﬁ
*	ulWriteRights		[IN]Œƒº˛–¥»®œﬁ
*/
ULONG DEVAPI SKF_CreateFile (HAPPLICATION hApplication, LPSTR szFileName, ULONG ulFileSize, ULONG ulReadRights,ULONG ulWriteRights);

/*
*	…æ≥˝÷∏∂®Œƒº˛£¨Œƒº˛…æ≥˝∫Û£¨Œƒº˛÷––¥»ÎµƒÀ˘”––≈œ¢Ω´∂™ ß°£Œƒº˛‘⁄…Ë±∏÷–µƒ’º”√µƒø’º‰Ω´±ª Õ∑≈°£
*	hApplication		[IN]“™…æ≥˝Œƒº˛À˘‘⁄µƒ”¶”√æ‰±˙
*	szFileName			[IN]“™…æ≥˝Œƒº˛µƒ√˚≥∆
*/
ULONG DEVAPI SKF_DeleteFile (HAPPLICATION hApplication, LPSTR szFileName);
/*
*	√∂æŸ“ª∏ˆ”¶”√œ¬¥Ê‘⁄µƒÀ˘”–Œƒº˛
*	hApplication		[IN]”¶”√µƒæ‰±˙
*	szFileList			[OUT]∑µªÿŒƒº˛√˚≥∆¡–±Ì£¨∏√≤Œ ˝Œ™ø’£¨”…pulSize∑µªÿŒƒº˛–≈œ¢À˘–Ë“™µƒø’º‰¥Û–°°£√ø∏ˆŒƒº˛√˚≥∆“‘µ•∏ˆ'\0'Ω· ¯£¨“‘À´'\0'±Ì æ¡–±ÌµƒΩ· ¯°£
*	pulSize				[OUT] ‰»ÎŒ™ ˝æ›ª∫≥Â«¯µƒ¥Û–°£¨ ‰≥ˆŒ™ µº Œƒº˛√˚≥∆µƒ¥Û–°
*/
ULONG DEVAPI SKF_EnumFiles (HAPPLICATION hApplication, LPSTR szFileList, ULONG *pulSize);

/*
*	ªÒ»°”¶”√Œƒº˛µƒ Ù–‘–≈œ¢£¨¿˝»ÁŒƒº˛µƒ¥Û–°°¢»®œﬁµ»
*	hApplication		[IN]Œƒº˛À˘‘⁄”¶”√µƒæ‰±˙
*	szFileName			[IN]Œƒº˛√˚≥∆
*	pFileInfo			[OUT]Œƒº˛–≈œ¢£¨÷∏œÚŒƒº˛ Ù–‘Ω·ππµƒ÷∏’Î
*/
ULONG DEVAPI SKF_GetFileInfo (HAPPLICATION hApplication, LPSTR szFileName, FILEATTRIBUTE *pFileInfo);

/*
*	∂¡»°Œƒº˛ƒ⁄»›
*	hApplication		[IN]Œƒº˛À˘‘⁄µƒ”¶”√æ‰±˙
*	szFileName			[IN]Œƒº˛√˚
*	ulOffset			[IN]Œƒº˛∂¡»°∆´“∆Œª÷√
*	ulSize				[IN]“™∂¡»°µƒ≥§∂»
*	pbOutData			[OUT]∑µªÿ ˝æ›µƒª∫≥Â«¯
*	pulOutLen			[OUT] ‰»Î±Ì æ∏¯≥ˆµƒª∫≥Â«¯¥Û–°£ª ‰≥ˆ±Ì æ µº ∂¡»°∑µªÿµƒ ˝æ›¥Û–°
*/
ULONG DEVAPI SKF_ReadFile (HAPPLICATION hApplication, LPSTR szFileName, ULONG ulOffset, ULONG ulSize, BYTE * pbOutData, ULONG *pulOutLen);

/*
*	–¥ ˝æ›µΩŒƒº˛÷–
*	hApplication		[IN]Œƒº˛À˘‘⁄µƒ”¶”√æ‰±˙
*	szFileName			[IN]Œƒº˛√˚
*	ulOffset			[IN]–¥»ÎŒƒº˛µƒ∆´“∆¡ø
*	pbData				[IN]–¥»Î ˝æ›ª∫≥Â«¯
*	ulSize				[IN]–¥»Î ˝æ›µƒ¥Û–°
*/
ULONG DEVAPI SKF_WriteFile (HAPPLICATION hApplication, LPSTR szFileName, ULONG  ulOffset, BYTE *pbData, ULONG ulSize);


/************************************************************************/
/*  5. »›∆˜π‹¿Ì	œµ¡–∫Ø ˝                                           */
/*	SKF_CreateContainer													*/
/*	SKF_DeleteContainer													*/
/*	SKF_EnumContainer													*/
/*	SKF_OpenContainer													*/
/*	SKF_CloseContainer													*/
/*	SKF_GetContainerType												*/
/*	SKF_ImportCertificate												*/
/*	SKF_ExportCertificate												*/
/************************************************************************/

/*
*	‘⁄”¶”√œ¬Ω®¡¢÷∏∂®√˚≥∆µƒ»›∆˜≤¢∑µªÿ»›∆˜æ‰±˙
*	hApplication		[IN]”¶”√æ‰±˙
*	szContainerName		[IN]ASCII◊÷∑˚¥Æ£¨±Ì æÀ˘Ω®¡¢»›∆˜µƒ√˚≥∆£¨»›∆˜√˚≥∆µƒ◊Ó¥Û≥§∂»≤ªƒ‹≥¨π˝64◊÷Ω⁄
*	phContainer			[OUT]∑µªÿÀ˘Ω®¡¢»›∆˜µƒ»›∆˜æ‰±˙
*/
ULONG DEVAPI SKF_CreateContainer (HAPPLICATION hApplication, LPSTR szContainerName, HCONTAINER *phContainer);
/*
*	‘⁄”¶”√œ¬…æ≥˝÷∏∂®√˚≥∆µƒ»›∆˜≤¢ Õ∑≈»›∆˜œ‡πÿµƒ◊ ‘¥
*	hApplication		[IN]”¶”√æ‰±˙
*	szContainerName		[IN]÷∏œÚ…æ≥˝»›∆˜µƒ√˚≥∆
*/
ULONG DEVAPI SKF_DeleteContainer(HAPPLICATION hApplication, LPSTR szContainerName);
/*
*	√∂æŸ”¶”√œ¬µƒÀ˘”–»›∆˜≤¢∑µªÿ»›∆˜√˚≥∆¡–±Ì
*	hApplication		[IN]”¶”√æ‰±˙
*	szContainerName		[OUT]÷∏œÚ»›∆˜√˚≥∆¡–±Ìª∫≥Â«¯£¨»Áπ˚¥À≤Œ ˝Œ™NULL ±£¨pulSize±Ì æ∑µªÿ ˝æ›À˘–Ë“™ª∫≥Â«¯µƒ≥§∂»£¨»Áπ˚¥À≤Œ ˝≤ªŒ™NULL ±£¨∑µªÿ»›∆˜√˚≥∆¡–±Ì£¨√ø∏ˆ»›∆˜√˚“‘µ•∏ˆ'\0'Œ™Ω· ¯£¨¡–±Ì“‘À´'\0'Ω· ¯
*	pulSize				[OUT]µ˜”√«∞±Ì æszContainerNameª∫≥Â«¯µƒ≥§∂»£¨∑µªÿ»›∆˜√˚≥∆¡–±Ìµƒ≥§∂»
*/
ULONG DEVAPI SKF_EnumContainer(HAPPLICATION	hApplication, LPSTR  szContainerName, ULONG* pulSize);
/*
*	ªÒ»°»›∆˜æ‰±˙
*	hApplication		[IN]”¶”√æ‰±˙
*	szContainerName		[IN]»›∆˜√˚≥∆
*	phContainer			[OUT]∑µªÿÀ˘¥Úø™»›∆˜µƒæ‰±˙
*/
ULONG DEVAPI SKF_OpenContainer(HAPPLICATION hApplication,LPSTR szContainerName,HCONTAINER *phContainer);

/*
*	πÿ±’»›∆˜æ‰±˙£¨≤¢ Õ∑≈»›∆˜æ‰±˙œ‡πÿ◊ ‘¥
*	hContainer			[OUT]»›∆˜æ‰±˙
*/
ULONG DEVAPI SKF_CloseContainer(HCONTAINER hContainer);

/*
ªÒ»°»›∆˜µƒ¿‡–Õ
hContainer	[IN] »›∆˜æ‰±˙°£
pulContainerType	[OUT] ªÒµ√µƒ»›∆˜¿‡–Õ°£÷∏’Î÷∏œÚµƒ÷µŒ™0±Ì æŒ¥∂®°¢…–Œ¥∑÷≈‰¿‡–ÕªÚ’ﬂŒ™ø’»›∆˜£¨Œ™1±Ì æŒ™RSA»›∆˜£¨Œ™2±Ì æŒ™ECC»›∆˜°£
*/
ULONG DEVAPI SKF_GetContainerType(HCONTAINER hContainer, ULONG *pulContainerType);

/*
œÚ»›∆˜ƒ⁄µº»Î ˝◊÷÷§ È
hContainer	[IN] »›∆˜æ‰±˙°£
bSignFlag	[IN] TRUE±Ì æ«©√˚÷§ È£¨FALSE±Ì æº”√‹÷§ È
pbCert		[IN] ÷§ Èª∫≥Â«¯
ulCertLen	[IN] ª∫≥Â«¯≥§∂»
*/
ULONG DEVAPI SKF_ImportCertificate(HCONTAINER hContainer, BOOL bSignFlag,  BYTE* pbCert, ULONG ulCertLen);

/*
µº≥ˆ»›∆˜ƒ⁄µƒ ˝◊÷÷§ È
hContainer	[IN] »›∆˜æ‰±˙°£
bSignFlag	[IN] TRUE±Ì æ«©√˚÷§ È£¨FALSE±Ì æº”√‹÷§ È
pbCert		[OUT] ÷§ Èª∫≥Â«¯
ulCertLen	[IN,OUT]  ‰»Îª∫≥Â«¯≥§∂»£¨ ‰≥ˆ÷§ Èƒ⁄»›≥§∂»
*/
ULONG DEVAPI SKF_ExportCertificate(HCONTAINER hContainer, BOOL bSignFlag,  BYTE* pbCert, ULONG *pulCertLen);

/************************************************************************/
/*  6. √‹¬Î∑˛ŒÒ	œµ¡–∫Ø ˝                                           */
/*	SKF_GetRandom														*/
/*	SKF_GenRSAKeyPair													*/
/*	SKF_ImportRSAKeyPair												*/
/*	SKF_RSASignData														*/
/*	SKF_RSAVerify														*/
/*	SKF_RSAExportSessionKey												*/
/*	SKF_GenECCKeyPair													*/
/*	SKF_ImportECCKeyPair												*/
/*	SKF_ECCSignData														*/
/*	SKF_ECCVerify														*/
/*	SKF_GenerateAgreementDataWithECC									*/
/*	SKF_GenerateAgreementDataAndKeyWithECC								*/
/*	SKF_GenerateKeyWithECC												*/
/*	SKF_ECCExportSessionKey												*/
/*	SKF_ExportPublicKey													*/
/*	SKF_ImportSessionKey												*/
/*	SKF_EncryptInit														*/
/*	SKF_Encrypt															*/
/*	SKF_EncryptUpdate													*/
/*	SKF_EncryptFinal													*/
/*	SKF_DecryptInit														*/
/*	SKF_Decrypt															*/
/*	SKF_DecryptUpdate													*/
/*	SKF_DecryptFinal													*/
/*	SKF_DigestInit														*/
/*	SKF_Digest															*/
/*	SKF_DigestUpdate													*/
/*	SKF_DegistFinal														*/
/*	SKF_MACInit															*/
/*	SKF_MAC																*/
/*	SKF_MACUpdate														*/
/*	SKF_MACFinal														*/
/*	SKF_CloseHandle														*/
/************************************************************************/

/*
*	≤˙…˙÷∏∂®≥§∂»µƒÀÊª˙ ˝
*	hDev			[IN] …Ë±∏æ‰±˙
*	pbRandom		[OUT] ∑µªÿµƒÀÊª˙ ˝
*	ulRandomLen		[IN] ÀÊª˙ ˝≥§∂»
*/
ULONG DEVAPI SKF_GenRandom (DEVHANDLE hDev, BYTE *pbRandom,ULONG ulRandomLen);

/*
*	”……Ë±∏…˙≥…RSA√‹‘ø∂‘≤¢√˜Œƒ ‰≥ˆ
*	hDev			[IN] …Ë±∏æ‰±˙
*	ulBitsLen		[IN] √‹‘øƒ£≥§
*	pBlob			[OUT] ∑µªÿµƒπ´‘ø ˝æ›Ω·ππ
*/
ULONG DEVAPI SKF_GenRSAKeyPair (HCONTAINER hContainer, ULONG ulBitsLen, RSAPUBLICKEYBLOB *pBlob);



/*
*	µº»ÎRSAº”√‹π´ÀΩ‘ø∂‘
*	hContainer		[IN] »›∆˜æ‰±˙
*	ulSymAlgId		[IN] ∂‘≥∆À„∑®√‹‘ø±Í ∂
*	pbWrappedKey	[IN]  π”√∏√»›∆˜ƒ⁄«©√˚π´‘ø±£ª§µƒ∂‘≥∆À„∑®√‹‘ø
*	ulWrappedKeyLen	[IN] ±£ª§µƒ∂‘≥∆À„∑®√‹‘ø≥§∂»
*	pbEncryptedData	[IN] ∂‘≥∆À„∑®√‹‘ø±£ª§µƒRSAº”√‹ÀΩ‘ø°£ÀΩ‘øµƒ∏Ò Ω◊Ò—≠PKCS #1 v2.1: RSA Cryptography Standard÷–µƒÀΩ‘ø∏Ò Ω∂®“Â
*	ulEncryptedDataLen	[IN] ∂‘≥∆À„∑®√‹‘ø±£ª§µƒRSAº”√‹π´ÀΩ‘ø∂‘≥§∂»
*/
ULONG DEVAPI SKF_ImportRSAKeyPair ( HCONTAINER hContainer, ULONG ulSymAlgId, 
								   BYTE *pbWrappedKey, ULONG ulWrappedKeyLen,
								   BYTE *pbEncryptedData, ULONG ulEncryptedDataLen);

/*
*	 π”√hContainer÷∏∂®»›∆˜µƒ«©√˚ÀΩ‘ø£¨∂‘÷∏∂® ˝æ›pbDataΩ¯–– ˝◊÷«©√˚°£«©√˚∫ÛµƒΩ·π˚¥Ê∑≈µΩpbSignatureª∫≥Â«¯£¨…Ë÷√pulSignLenŒ™«©√˚µƒ≥§∂»
*	hContainer		[IN] ”√¿¥«©√˚µƒÀΩ‘øÀ˘‘⁄»›∆˜æ‰±˙
*	pbData			[IN] ±ª«©√˚µƒ ˝æ›
*	ulDataLen		[IN] «©√˚ ˝æ›≥§∂»£¨”¶≤ª¥Û”⁄RSA√‹‘øƒ£≥§-11
*	pbSignature		[OUT] ¥Ê∑≈«©√˚Ω·π˚µƒª∫≥Â«¯÷∏’Î£¨»Áπ˚÷µŒ™NULL£¨”√”⁄»°µ√«©√˚Ω·π˚≥§∂»
*	pulSigLen		[IN,OUT]  ‰»ÎŒ™«©√˚Ω·π˚ª∫≥Â«¯¥Û–°£¨ ‰≥ˆŒ™«©√˚Ω·π˚≥§∂»
*/
ULONG DEVAPI SKF_RSASignData(HCONTAINER hContainer, BYTE *pbData, ULONG  ulDataLen, BYTE *pbSignature, ULONG *pulSignLen);
/*
*	—È÷§RSA«©√˚°£”√pRSAPubKeyBlobƒ⁄µƒπ´‘ø÷µ∂‘¥˝—È«© ˝æ›Ω¯––—È«©°£
*	hDev			[IN] ¡¨Ω”…Ë±∏ ±∑µªÿµƒ…Ë±∏æ‰±˙
*	pRSAPubKeyBlob	[IN] RSAπ´‘ø ˝æ›Ω·ππ
*	pbData			[IN] ¥˝—È÷§«©√˚µƒ ˝æ›
*	ulDataLen		[IN]  ˝æ›≥§∂»£¨”¶≤ª¥Û”⁄π´‘øƒ£≥§-11
*	pbSignature		[IN] ¥˝—È÷§µƒ«©√˚÷µ
*	ulSignLen		[IN] «©√˚÷µ≥§∂»£¨±ÿ–ÎŒ™π´‘øƒ£≥§
*/
ULONG DEVAPI SKF_RSAVerify (DEVHANDLE hDev , RSAPUBLICKEYBLOB* pRSAPubKeyBlob, BYTE *pbData, ULONG  ulDataLen, BYTE *pbSignature, ULONG ulSignLen);
/*
*	…˙≥…ª·ª∞√‹‘ø≤¢”√Õ‚≤øπ´‘øº”√‹ ‰≥ˆ°£
*	hContainer		[IN] »›∆˜æ‰±˙
*	ulAlgID			[IN] ª·ª∞√‹‘øµƒÀ„∑®±Í ∂
*	pPubKey			[IN] º”√‹ª·ª∞√‹‘øµƒRSAπ´‘ø ˝æ›Ω·ππ
*	pbData			[OUT] µº≥ˆµƒº”√‹ª·ª∞√‹‘ø√‹Œƒ£¨∞¥’’PKCS#1v1.5µƒ“™«Û∑‚◊∞
*	pulDataLen		[OUT] ∑µªÿµº≥ˆ ˝æ›≥§∂»
*	phSessionKey	[OUT] µº≥ˆµƒ√‹‘øæ‰±˙
*/

ULONG DEVAPI SKF_RSAExportSessionKey (HCONTAINER hContainer, ULONG ulAlgId, RSAPUBLICKEYBLOB *pPubKey, BYTE *pbData, ULONG  *pulDataLen, HANDLE *phSessionKey);


/*
*	…˙≥…ECC«©√˚√‹‘ø∂‘≤¢ ‰≥ˆ«©√˚π´‘ø°£
*	hContainer		[IN] »›∆˜æ‰±˙
*	÷ª÷ß≥÷SGD_SM2_1À„∑®
*	pBlob			[OUT] ∑µªÿECCπ´‘ø ˝æ›Ω·ππ
*/
ULONG DEVAPI SKF_GenECCKeyPair (HCONTAINER hContainer, ULONG ulAlgId, ECCPUBLICKEYBLOB *pBlob);

/*
*	µº»ÎECCπ´ÀΩ‘ø∂‘
*	hContainer		[IN] »›∆˜æ‰±˙
*	pbWrapedData	[IN] º”√‹±£ª§µƒECCº”√‹π´ÀΩ‘ø∂‘√‹Œƒ
*	ulWrapedLen		[IN]  ˝æ›≥§∂»
*/

ULONG DEVAPI SKF_ImportECCKeyPair (  HCONTAINER hContainer, PENVELOPEDKEYBLOB pEnvelopedKeyBlob);

/*
*	ECC ˝◊÷«©√˚°£≤…”√ECCÀ„∑®∫Õ÷∏∂®ÀΩ‘øhKey£¨∂‘÷∏∂® ˝æ›pbDataΩ¯–– ˝◊÷«©√˚°£«©√˚∫ÛµƒΩ·π˚¥Ê∑≈µΩpbSignatureª∫≥Â«¯£¨…Ë÷√pulSignLenŒ™«©√˚÷µµƒ≥§∂»
*	hContainer		[IN] ”√¿¥«©√˚µƒÀΩ‘øÀ˘‘⁄»›∆˜æ‰±˙
*	pbData			[IN] ±ª«©√˚µƒ ˝æ›
*	ulDataLen		[IN] ¥˝«©√˚ ˝æ›≥§∂»£¨±ÿ–Î–°”⁄√‹‘øƒ£≥§
*	pbSignature		[OUT] «©√˚÷µ£¨Œ™NULL ±”√”⁄ªÒµ√«©√˚÷µµƒ≥§∂»
*	pulSigLen		[IN,OUT] ∑µªÿ«©√˚÷µ≥§∂»µƒ÷∏’Î 
*/

ULONG DEVAPI SKF_ECCSignData (HCONTAINER hContainer, BYTE *pbData, ULONG  ulDataLen, PECCSIGNATUREBLOB pSignature);

/*
*	”√ECCπ´‘ø∂‘ ˝æ›Ω¯––—È«©
*	hDev			[IN] …Ë±∏æ‰±˙
*	pECCPubKeyBlob	[IN] ECCπ´‘ø ˝æ›Ω·ππ
*	pbData			[IN] ¥˝—È÷§«©√˚µƒ ˝æ›
*	ulDataLen		[IN]  ˝æ›≥§∂»
*	pbSignature		[IN] ¥˝—È÷§µƒ«©√˚÷µ
*	ulSigLen		[IN] «©√˚÷µ≥§∂»
*/
ULONG DEVAPI SKF_ECCVerify (DEVHANDLE hDev , ECCPUBLICKEYBLOB* pECCPubKeyBlob, BYTE *pbData, ULONG  ulDataLen, PECCSIGNATUREBLOB pSignature);

/*
*	…˙≥…ª·ª∞√‹‘ø≤¢”√Õ‚≤øπ´‘øº”√‹ ‰≥ˆ°£
*	hContainer		[IN] »›∆˜æ‰±˙
*	ulAlgID			[IN] ª·ª∞√‹‘øµƒÀ„∑®±Í ∂
*	pPubKey			[IN] ”√¿¥µº≥ˆ√‹‘øµƒ√‹‘øΩ·ππ
*	pbData			[OUT] µº≥ˆµƒº”√‹ª·ª∞√‹‘ø√‹Œƒ, ◊¢“‚¥À¥¶¥´»Îµƒ≥§∂»“™¥Û”⁄ECCCIPHERBLOBΩ·ππµƒ≥§∂»£¨Ω·ππƒ⁄∫¨÷∏’Î
*	phSessionKey	[OUT] ª·ª∞√‹‘øæ‰±˙
*/
ULONG DEVAPI SKF_ECCExportSessionKey (HCONTAINER hContainer, ULONG ulAlgId, ECCPUBLICKEYBLOB *pPubKey, PECCCIPHERBLOB pData, HANDLE *phSessionKey);


/*
*	 π”√ECC√‹‘ø–≠…ÃÀ„∑®£¨Œ™º∆À„ª·ª∞√‹‘ø∂¯≤˙…˙–≠…Ã≤Œ ˝£¨∑µªÿ¡Ÿ ±ECC√‹‘ø∂‘µƒπ´‘øº∞–≠…Ãæ‰±˙
*	hContainer		[IN] »›∆˜æ‰±˙
*	ulAlgId			[IN] ª·ª∞√‹‘øÀ„∑®±Í ∂
*	pTempECCPubKeyBlob	[OUT] ∑¢∆∑Ω¡Ÿ ±ECCπ´‘ø
*	pbID			[IN] ∑¢∆∑ΩµƒID
*	ulIDLen			[IN] ∑¢∆∑ΩIDµƒ≥§∂»£¨≤ª¥Û”⁄32
*	phAgreementHandle	[OUT] ∑µªÿµƒ√‹‘ø–≠…Ãæ‰±˙
*/
ULONG DEVAPI SKF_GenerateAgreementDataWithECC (HCONTAINER hContainer, ULONG ulAlgId,ECCPUBLICKEYBLOB*  pTempECCPubKeyBlob,BYTE* pbID, ULONG ulIDLen,HANDLE *phAgreementHandle);

/*
*	 π”√ECC√‹‘ø–≠…ÃÀ„∑®£¨≤˙…˙–≠…Ã≤Œ ˝≤¢º∆À„ª·ª∞√‹‘ø£¨ ‰≥ˆ¡Ÿ ±ECC√‹‘ø∂‘π´‘ø£¨≤¢∑µªÿ≤˙…˙µƒ√‹‘øæ‰±˙
*	hContainer					[IN] »›∆˜æ‰±˙
*	ulAlgId						[IN] ª·ª∞√‹‘øÀ„∑®±Í ∂
*	pSponsorECCPubKeyBlob		[IN] ∑¢∆∑ΩµƒECCπ´‘ø
*	pSponsorTempECCPubKeyBlob	[IN] ∑¢∆∑Ωµƒ¡Ÿ ±ECCπ´‘ø
*	pTempECCPubKeyBlob			[OUT] œÏ”¶∑Ωµƒ¡Ÿ ±ECCπ´‘ø
*	pbID						[IN] œÏ”¶∑ΩµƒID
*	ulIDLen						[IN] œÏ”¶∑ΩIDµƒ≥§∂»£¨≤ª¥Û”⁄32
*	pbSponsorID					[IN] ∑¢∆∑ΩµƒID
*	ulSponsorIDLen				[IN] ∑¢∆∑ΩIDµƒ≥§∂»£¨≤ª¥Û”⁄32
*	phKeyHandle					[OUT] ∑µªÿµƒ∂‘≥∆À„∑®√‹‘øæ‰±˙
*/
ULONG DEVAPI SKF_GenerateAgreementDataAndKeyWithECC(
	HANDLE hContainer, ULONG ulAlgId,
	ECCPUBLICKEYBLOB*  pSponsorECCPubKeyBlob,
	ECCPUBLICKEYBLOB*  pSponsorTempECCPubKeyBlob,
	ECCPUBLICKEYBLOB*  pTempECCPubKeyBlob,
	BYTE* pbID, ULONG ulIDLen, BYTE *pbSponsorID, ULONG ulSponsorIDLen,
	HANDLE *phKeyHandle);

/*
*	 π”√ECC√‹‘ø–≠…ÃÀ„∑®£¨ π”√◊‘…Ì–≠…Ãæ‰±˙∫ÕœÏ”¶∑Ωµƒ–≠…Ã≤Œ ˝º∆À„ª·ª∞√‹‘ø£¨Õ¨ ±∑µªÿª·ª∞√‹‘øæ‰±˙
*	hAgreementHandle			[IN] √‹‘ø–≠…Ãæ‰±˙
*	pECCPubKeyBlob				[IN] Õ‚≤ø ‰»ÎµƒœÏ”¶∑ΩECCπ´‘ø
*	pTempECCPubKeyBlob			[IN] Õ‚≤ø ‰»ÎµƒœÏ”¶∑Ω¡Ÿ ±ECCπ´‘ø
*	pbID						[IN] œÏ”¶∑ΩµƒID
*	ulIDLen						[IN] œÏ”¶∑ΩIDµƒ≥§∂»£¨≤ª¥Û”⁄32
*	phKeyHandle					[OUT] ∑µªÿµƒ√‹‘øæ‰±˙
*/
ULONG DEVAPI SKF_GenerateKeyWithECC (HANDLE hAgreementHandle,
									 ECCPUBLICKEYBLOB*  pECCPubKeyBlob,
									 ECCPUBLICKEYBLOB*  pTempECCPubKeyBlob,
									 BYTE* pbID, ULONG ulIDLen, HANDLE *phKeyHandle);


/*
*	µº≥ˆ»›∆˜÷–µƒ«©√˚π´‘øªÚ’ﬂº”√‹π´‘ø
*	hContainer		[IN] »›∆˜æ‰±˙
*	bSignFlag		[IN] TRUE±Ì æµº≥ˆ«©√˚π´‘ø£¨FALSE±Ì æµº≥ˆº”√‹π´‘ø
*	pbBlob			[OUT] ÷∏œÚRSAπ´‘øΩ·ππ£®RSAPUBLICKEYBLOB£©ªÚ’ﬂECCπ´‘øΩ·ππ£®ECCPUBLICKEYBLOB£©£¨»Áπ˚¥À≤Œ ˝Œ™NULL ±£¨”…pulBlobLen∑µªÿpbBlobµƒ≥§∂»
*	pulBlobLen		[IN,OUT] µ˜”√ ±±Ì æpbBlobµƒ≥§∂»£¨∑µªÿµº≥ˆπ´‘øΩ·ππµƒ¥Û–°
*/
ULONG DEVAPI SKF_ExportPublicKey (HCONTAINER hContainer, BOOL bSignFlag, BYTE* pbBlob, ULONG* pulBlobLen);

/*
*	µº»Îª·ª∞√‹‘ø
*	hDev			[IN] …Ë±∏æ‰±˙
*	pECCPubKeyBlob	[IN] º”√‹ π”√µƒπ´‘ø
*	pbPlainText		[IN] “™º”√‹µƒ ˝æ›
*	ulPlainTextLen	[IN]  ˝æ›≥§∂»
*	pCipherText		[OUT] ∑µªÿµƒ√‹Œƒ
*/
ULONG DEVAPI SKF_ExtECCEncrypt(DEVHANDLE hDev, ECCPUBLICKEYBLOB *pECCPubKeyBlob,
							   BYTE* pbPlainText, ULONG ulPlainTextLen, 
							   PECCCIPHERBLOB pCipherText);


/*
*	µº»Îª·ª∞√‹‘ø
*	hContainer		[IN] »›∆˜æ‰±˙
*	ulAlgID			[IN] ª·ª∞√‹‘øµƒÀ„∑®±Í ∂
*	pbWrapedData	[IN] “™µº»Îµƒ ˝æ›
*	ulWrapedLen		[IN]  ˝æ›≥§∂»
*	phKey			[OUT] ∑µªÿª·ª∞√‹‘øæ‰±˙
*/
ULONG DEVAPI SKF_ImportSessionKey (HCONTAINER hContainer, ULONG ulAlgId,BYTE *pbWrapedData,ULONG ulWrapedLen,HANDLE *phKey);


/*
*	 ˝æ›º”√‹≥ı ºªØ°£…Ë÷√ ˝æ›º”√‹µƒÀ„∑®œ‡πÿ≤Œ ˝°£
*	hKey			[IN] º”√‹√‹‘øæ‰±˙
*	EncryptParam	[IN] ∑÷◊È√‹¬ÎÀ„∑®œ‡πÿ≤Œ ˝£∫À„∑®±Í ∂∫≈°¢√‹‘ø≥§∂»°¢≥ı ºœÚ¡ø°¢≥ı ºœÚ¡ø≥§∂»°¢ÃÓ≥‰∑Ω∑®°¢º”√‹ƒ£ Ω°¢∑¥¿°÷µµƒŒª≥§∂»
*/
ULONG DEVAPI SKF_EncryptInit (HANDLE hKey, BLOCKCIPHERPARAM EncryptParam);

/*
*	µ•“ª∑÷◊È ˝æ›µƒº”√‹≤Ÿ◊˜°£
”√÷∏∂®º”√‹√‹‘ø∂‘÷∏∂® ˝æ›Ω¯––º”√‹£¨±ªº”√‹µƒ ˝æ›÷ª∞¸∫¨“ª∏ˆ∑÷◊È£¨º”√‹∫Ûµƒ√‹Œƒ±£¥ÊµΩ÷∏∂®µƒª∫≥Â«¯÷–°£
SKF_Encrypt÷ª∂‘µ•∏ˆ∑÷◊È ˝æ›Ω¯––º”√‹£¨‘⁄µ˜”√SKF_Encrypt÷Æ«∞£¨±ÿ–Îµ˜”√SKF_EncryptInit≥ı ºªØº”√‹≤Ÿ◊˜°£
SKF_Encyptµ»º€”⁄œ»µ˜”√SKF_EncryptUpdate‘Ÿµ˜”√SKF_EncryptFinal°£
*	hKey			[IN] º”√‹√‹‘øæ‰±˙
*	pbData			[IN] ¥˝º”√‹ ˝æ›
*	ulDataLen		[IN] ¥˝º”√‹ ˝æ›≥§∂»
*	pbEncryptedData [OUT] º”√‹∫Ûµƒ ˝æ›ª∫≥Â«¯÷∏’Î
*	pulEncryptedLen [IN,OUT]  ‰»Î£¨∏¯≥ˆµƒª∫≥Â«¯¥Û–°£ª ‰≥ˆ£¨∑µªÿº”√‹∫Ûµƒ ˝æ›
≥§∂»
*	≥…π¶: SAR_OK
*	 ß∞‹: SAR_FAIL SAR_MEMORYERR SAR_UNKNOWNERR  SAR_INVALIDPARAMERR SAR_BUFFER_TOO_SMALL   
*/
ULONG DEVAPI SKF_Encrypt(HANDLE hKey, BYTE * pbData, ULONG ulDataLen, BYTE *pbEncryptedData, ULONG *pulEncryptedLen);


/*
*	∂‡∏ˆ∑÷◊È ˝æ›µƒº”√‹≤Ÿ◊˜°£
”√÷∏∂®º”√‹√‹‘ø∂‘÷∏∂® ˝æ›Ω¯––º”√‹£¨±ªº”√‹µƒ ˝æ›∞¸∫¨∂‡∏ˆ∑÷◊È£¨º”√‹∫Ûµƒ√‹Œƒ±£¥ÊµΩ÷∏∂®µƒª∫≥Â«¯÷–°£
SKF_EncryptUpdate∂‘∂‡∏ˆ∑÷◊È ˝æ›Ω¯––º”√‹£¨‘⁄µ˜”√SKF_EncryptUpdate÷Æ«∞£¨±ÿ–Îµ˜”√SKF_EncryptInit≥ı ºªØº”√‹≤Ÿ◊˜£ª
‘⁄µ˜”√SKF_EncryptUpdate÷Æ∫Û£¨±ÿ–Îµ˜”√SKF_EncryptFinalΩ· ¯º”√‹≤Ÿ◊˜°£
*	hKey			[IN] º”√‹√‹‘øæ‰±˙
*	pbData			[IN] ¥˝º”√‹ ˝æ›
*	ulDataLen		[IN] ¥˝º”√‹ ˝æ›≥§∂»
*	pbEncryptedData [OUT] º”√‹∫Ûµƒ ˝æ›ª∫≥Â«¯÷∏’Î
*	pulEncryptedLen [OUT] ∑µªÿº”√‹∫Ûµƒ ˝æ›≥§∂»
*/
ULONG DEVAPI SKF_EncryptUpdate(HANDLE hKey, BYTE * pbData, ULONG ulDataLen, BYTE *pbEncryptedData, ULONG *pulEncryptedLen);

/*
*	Ω· ¯∂‡∏ˆ∑÷◊È ˝æ›µƒº”√‹£¨∑µªÿ £”‡º”√‹Ω·π˚°£
œ»µ˜”√SKF_EncryptInit≥ı ºªØº”√‹≤Ÿ◊˜£¨
‘Ÿµ˜”√SKF_EncryptUpdate∂‘∂‡∏ˆ∑÷◊È ˝æ›Ω¯––º”√‹£¨
◊Ó∫Ûµ˜”√SKF_EncryptFinalΩ· ¯∂‡∏ˆ∑÷◊È ˝æ›µƒº”√‹°£
*	hKey			[IN] º”√‹√‹‘øæ‰±˙
*	pbEncryptedData [OUT] º”√‹Ω·π˚µƒª∫≥Â«¯
*	pulEncryptedLen [OUT] º”√‹Ω·π˚µƒ≥§∂»
*/
ULONG DEVAPI SKF_EncryptFinal (HANDLE hKey, BYTE *pbEncryptedData, ULONG *ulEncryptedDataLen );

/*
*	 ˝æ›Ω‚√‹≥ı ºªØ£¨…Ë÷√Ω‚√‹√‹‘øœ‡πÿ≤Œ ˝°£
µ˜”√SKF_DecryptInit÷Æ∫Û£¨ø…“‘µ˜”√SKF_Decrypt∂‘µ•∏ˆ∑÷◊È ˝æ›Ω¯––Ω‚√‹£¨
“≤ø…“‘∂‡¥Œµ˜”√SKF_DecryptUpdate÷Æ∫Û‘Ÿµ˜”√SKF_DecryptFinalÕÍ≥…∂‘∂‡∏ˆ∑÷◊È ˝æ›µƒΩ‚√‹°£
*	hKey [IN] Ω‚√‹√‹‘øæ‰±˙
*	DecryptParam [IN] ∑÷◊È√‹¬ÎÀ„∑®œ‡πÿ≤Œ ˝£∫À„∑®±Í ∂∫≈°¢√‹‘ø≥§∂»°¢≥ı ºœÚ¡ø°¢≥ı ºœÚ¡ø≥§∂»°¢ÃÓ≥‰∑Ω∑®°¢º”√‹ƒ£ Ω°¢∑¥¿°÷µµƒŒª≥§∂»
*/
ULONG DEVAPI SKF_DecryptInit (HANDLE hKey, BLOCKCIPHERPARAM DecryptParam);

/*
*	µ•∏ˆ∑÷◊È ˝æ›µƒΩ‚√‹≤Ÿ◊˜
”√÷∏∂®Ω‚√‹√‹‘ø∂‘÷∏∂® ˝æ›Ω¯––Ω‚√‹£¨±ªΩ‚√‹µƒ ˝æ›÷ª∞¸∫¨“ª∏ˆ∑÷◊È£¨Ω‚√‹∫Ûµƒ√˜Œƒ±£¥ÊµΩ÷∏∂®µƒª∫≥Â«¯÷–
SKF_Decrypt÷ª∂‘µ•∏ˆ∑÷◊È ˝æ›Ω¯––Ω‚√‹£¨‘⁄µ˜”√SKF_Decrypt÷Æ«∞£¨±ÿ–Îµ˜”√SKF_DecryptInit≥ı ºªØ
Ω‚√‹≤Ÿ◊˜
SKF_Decyptµ»º€”⁄œ»µ˜”√SKF_DecryptUpdate‘Ÿµ˜”√SKF_DecryptFinal
*	hKey			[IN] Ω‚√‹√‹‘øæ‰±˙
*	pbEncryptedData [IN] ¥˝Ω‚√‹ ˝æ›
*	ulEncryptedLen	[IN] ¥˝Ω‚√‹ ˝æ›≥§∂»
*	pbData			[OUT] ÷∏œÚΩ‚√‹∫Ûµƒ ˝æ›ª∫≥Â«¯÷∏’Î£¨µ±Œ™NULL ±ø…ªÒµ√Ω‚√‹∫Ûµƒ ˝æ›≥§∂»
*	pulDataLen		[IN£¨OUT] ∑µªÿΩ‚√‹∫Ûµƒ ˝æ›≥§∂»
*/
ULONG DEVAPI SKF_Decrypt(HANDLE hKey, BYTE * pbEncryptedData, ULONG ulEncryptedLen, BYTE * pbData, ULONG * pulDataLen);

/*
*	∂‡∏ˆ∑÷◊È ˝æ›µƒΩ‚√‹≤Ÿ◊˜°£
”√÷∏∂®Ω‚√‹√‹‘ø∂‘÷∏∂® ˝æ›Ω¯––Ω‚√‹£¨±ªΩ‚√‹µƒ ˝æ›∞¸∫¨∂‡∏ˆ∑÷◊È£¨Ω‚√‹∫Ûµƒ√˜Œƒ±£¥ÊµΩ÷∏∂®µƒª∫≥Â«¯÷–°£
SKF_DecryptUpdate∂‘∂‡∏ˆ∑÷◊È ˝æ›Ω¯––Ω‚√‹£¨‘⁄µ˜”√SKF_DecryptUpdate÷Æ«∞£¨±ÿ–Îµ˜”√SKF_DecryptInit≥ı ºªØΩ‚√‹≤Ÿ◊˜£ª
‘⁄µ˜”√SKF_DecryptUpdate÷Æ∫Û£¨±ÿ–Îµ˜”√SKF_DecryptFinalΩ· ¯Ω‚√‹≤Ÿ◊˜°£
*	hKey			[IN] Ω‚√‹√‹‘øæ‰±˙
*	pbEncryptedData [IN] ¥˝Ω‚√‹ ˝æ›
*	ulEncryptedLen	[IN] ¥˝Ω‚√‹ ˝æ›≥§∂»
*	pbData			[OUT] ÷∏œÚΩ‚√‹∫Ûµƒ ˝æ›ª∫≥Â«¯÷∏’Î
*	pulDataLen		[IN£¨OUT] ∑µªÿΩ‚√‹∫Ûµƒ ˝æ›≥§∂»
*/
ULONG DEVAPI SKF_DecryptUpdate(HANDLE hKey, BYTE * pbEncryptedData, ULONG ulEncryptedLen, BYTE * pbData, ULONG * pulDataLen);

/*
*	Ω· ¯∂‡∏ˆ∑÷◊È ˝æ›µƒΩ‚√‹°£
*	hKey				[IN] Ω‚√‹√‹‘øæ‰±˙
*	pbPlainText			[OUT] ÷∏œÚΩ‚√‹Ω·π˚µƒª∫≥Â«¯£¨»Áπ˚¥À≤Œ ˝Œ™NULL ±£¨”…pulPlainTextLen∑µªÿΩ‚√‹Ω·π˚µƒ≥§∂»
*	pulDecyptedDataLen	[IN£¨OUT] µ˜”√ ±±Ì æpbPlainTextª∫≥Â«¯µƒ≥§∂»£¨∑µªÿΩ‚√‹Ω·π˚µƒ≥§∂» 
*/
ULONG DEVAPI SKF_DecryptFinal (HANDLE hKey, BYTE *pbDecryptedData, ULONG *pulDecryptedDataLen);

/*
*	≥ı ºªØœ˚œ¢‘”¥’º∆À„≤Ÿ◊˜£¨÷∏∂®º∆À„œ˚œ¢‘”¥’µƒÀ„∑®°£
*	hDev			[IN] ¡¨Ω”…Ë±∏ ±∑µªÿµƒ…Ë±∏æ‰±˙
*	ulAlgID			[IN] ‘”¥’À„∑®±Í ∂
*	phHash			[OUT] ‘”¥’∂‘œÛæ‰±˙
*/
ULONG DEVAPI SKF_DigestInit(DEVHANDLE hDev, ULONG ulAlgID,  ECCPUBLICKEYBLOB *pPubKey, unsigned char *pucID, ULONG ulIDLen, HANDLE *phHash);

/*
*	∂‘µ•“ª∑÷◊Èµƒœ˚œ¢Ω¯––‘”¥’º∆À„°£
*	hHash			[IN] ‘”¥’∂‘œÛæ‰±˙
*	pbData			[IN] ÷∏œÚœ˚œ¢ ˝æ›µƒª∫≥Â«¯
*	ulDataLen		[IN] œ˚œ¢ ˝æ›µƒ≥§∂»
*	pbHashData		[OUT] ‘”¥’ ˝æ›ª∫≥Â«¯÷∏’Î£¨µ±¥À≤Œ ˝Œ™NULL ±£¨”…pulHashLen∑µªÿ‘”¥’Ω·π˚µƒ≥§∂»
*	pulHashLen		[IN£¨OUT] µ˜”√ ±±Ì æpbHashDataª∫≥Â«¯µƒ≥§∂»£¨∑µªÿ‘”¥’Ω·π˚µƒ≥§∂»
*/
ULONG DEVAPI SKF_Digest (HANDLE hHash, BYTE *pbData, ULONG ulDataLen, BYTE *pbHashData, ULONG *pulHashLen);
/*
*	∂‘∂‡∏ˆ∑÷◊Èµƒœ˚œ¢Ω¯––‘”¥’º∆À„°£
*	hHash			[IN] ‘”¥’∂‘œÛæ‰±˙
*	pbPart			[IN] ÷∏œÚœ˚œ¢ ˝æ›µƒª∫≥Â«¯
*	ulPartLen		[IN] œ˚œ¢ ˝æ›µƒ≥§∂»
*/
ULONG DEVAPI SKF_DigestUpdate (HANDLE hHash, BYTE *pbData, ULONG  ulDataLen);
/*
*	Ω· ¯∂‡∏ˆ∑÷◊Èœ˚œ¢µƒ‘”¥’º∆À„≤Ÿ◊˜£¨Ω´‘”¥’±£¥ÊµΩ÷∏∂®µƒª∫≥Â«¯°£
*	hHash			[IN] π˛œ£∂‘œÛæ‰±˙
*	pHashData		[OUT] ∑µªÿµƒ‘”¥’ ˝æ›ª∫≥Â«¯÷∏’Î£¨»Áπ˚¥À≤Œ ˝NULL ±£¨”…pulHashLen∑µªÿ‘”¥’Ω·π˚µƒ≥§∂»
*	pulHashLen		[IN£¨OUT] µ˜”√ ±±Ì æ‘”¥’Ω·π˚µƒ≥§∂»£¨∑µªÿ‘”¥’ ˝æ›µƒ≥§∂»
*/
ULONG DEVAPI SKF_DigestFinal (HANDLE hHash, BYTE *pHashData, ULONG  *pulHashLen);

/*
*	≥ı ºªØœ˚œ¢»œ÷§¬Îº∆À„≤Ÿ◊˜£¨…Ë÷√º∆À„œ˚œ¢»œ÷§¬Îµƒ√‹‘ø≤Œ ˝£¨≤¢∑µªÿœ˚œ¢»œ÷§¬Îæ‰±˙°£
*	hKey			[IN] º∆À„œ˚œ¢»œ÷§¬Îµƒ√‹‘øæ‰±˙
*	MacParam		[IN] œ˚œ¢»œ÷§º∆À„œ‡πÿ≤Œ ˝£¨∞¸¿®≥ı ºœÚ¡ø°¢≥ı ºœÚ¡ø≥§∂»°¢ÃÓ≥‰∑Ω∑®µ»
*	phMac			[OUT] œ˚œ¢»œ÷§¬Î∂‘œÛæ‰±˙
*/
ULONG DEVAPI SKF_MacInit (HANDLE hKey, BLOCKCIPHERPARAM* pMacParam, HANDLE *phMac);

/*
*	SKF_Macº∆À„µ•“ª∑÷◊È ˝æ›µƒœ˚œ¢»œ÷§¬Î°£
*	hMac			[IN] œ˚œ¢»œ÷§¬Îæ‰±˙
*	pbData			[IN] ÷∏œÚ¥˝º∆À„ ˝æ›µƒª∫≥Â«¯
*	ulDataLen		[IN] ¥˝º∆À„ ˝æ›µƒ≥§∂»
*	pbMacData		[OUT] ÷∏œÚº∆À„∫ÛµƒMacΩ·π˚£¨»Áπ˚¥À≤Œ ˝Œ™NULL ±£¨”…pulMacLen∑µªÿº∆À„∫ÛMacΩ·π˚µƒ≥§∂»
*	pulMacLen		[IN£¨OUT] µ˜”√ ±±Ì æpbMacDataª∫≥Â«¯µƒ≥§∂»£¨∑µªÿº∆À„MacΩ·π˚µƒ≥§∂»
*/
ULONG DEVAPI SKF_Mac(HANDLE hMac, BYTE* pbData, ULONG ulDataLen, BYTE *pbMacData, ULONG *pulMacLen);
/*
*	º∆À„∂‡∏ˆ∑÷◊È ˝æ›µƒœ˚œ¢»œ÷§¬Î°£
*	hMac			[IN] œ˚œ¢»œ÷§¬Îæ‰±˙
*	pbData			[IN] ÷∏œÚ¥˝º∆À„ ˝æ›µƒª∫≥Â«¯
*	plDataLen		[IN] ¥˝º∆À„ ˝æ›µƒ≥§∂»
*/
ULONG DEVAPI SKF_MacUpdate(HANDLE hMac, BYTE * pbData, ULONG ulDataLen);
/*
*	Ω· ¯∂‡∏ˆ∑÷◊È ˝æ›µƒœ˚œ¢»œ÷§¬Îº∆À„≤Ÿ◊˜
*	hMac			[IN] œ˚œ¢»œ÷§¬Îæ‰±˙
*	pbMacData		[OUT] ÷∏œÚœ˚œ¢»œ÷§¬Îµƒª∫≥Â«¯£¨µ±¥À≤Œ ˝Œ™NULL ±£¨”…pulMacDataLen∑µªÿœ˚œ¢»œ÷§¬Î∑µªÿµƒ≥§∂»
*	pulMacDataLen	[OUT] µ˜”√ ±±Ì æœ˚œ¢»œ÷§¬Îª∫≥Â«¯µƒ◊Ó¥Û≥§∂»£¨∑µªÿœ˚œ¢»œ÷§¬Îµƒ≥§∂»
*/
ULONG DEVAPI SKF_MacFinal (HANDLE hMac, BYTE *pbMacData, ULONG *pulMacDataLen);
/*
*	πÿ±’ª·ª∞√‹‘ø°¢‘”¥’°¢œ˚œ¢»œ÷§¬Îæ‰±˙°£
*	hHandle			[IN] “™πÿ±’µƒ∂‘œÛæ‰±˙
*/
ULONG DEVAPI SKF_CloseHandle(HANDLE hHandle);


/*****************************“‘œ¬Œ™∑Ω±„”√ªß π”√À˘Ã·π©µƒ≤π≥‰API********************************************/

/*
*	…Ë÷√√˜Œƒ∂‘≥∆√‹‘ø£¨∑µªÿ√‹‘øæ‰±˙
*	hDev			[IN] …Ë±∏æ‰±˙
*	pbKey			[IN] ÷∏œÚª·ª∞√‹‘ø÷µµƒª∫≥Â«¯
*	ulAlgID			[IN] ª·ª∞√‹‘øµƒÀ„∑®±Í ∂
*	phKey			[OUT] ∑µªÿª·ª∞√‹‘øæ‰±˙
*/
ULONG DEVAPI SKF_SetSymmKey (DEVHANDLE hDev,  BYTE* pbKey, ULONG ulAlgID, HANDLE* phKey);



#ifdef __cplusplus
}
#endif

#endif //_SKFAPI_H_

